<?php
include(dirname(__FILE__)."/../ZadminGallery.php");
class ZitemController extends FrontController
{	
	public static $initialized = false;
	public $item;
	public $errors;
	public function __construct() {
		parent::__construct();
	}
	
	public function setMedia()
	{
		parent::setMedia();
		$id_item = ((int)(Tools::getValue('item')));
		$id_ct = ((int)(Tools::getValue('ct')));
		if (!$id_item) $id_item = 0;
		
		$name = array (
			0=> "Bộ sưu tập",
			1=> 'Trang Phục',
			2=> 'Phụ Kiện',
			3=> 'Mỹ Phẩm + Trang sức',
			4=> 'Stylist',
		);
		self::$smarty->assign(array(
			'meta_title'=> $name[$id_item],
			'meta_description' => 'adada',
		));
		
		Tools::addCSS(_MODULE_DIR_.'zgallery/css/item.css');
		Tools::addJS(_MODULE_DIR_.'zgallery/js/zgallery-scroll.js');
	}
	
	public function process()
	{
		global $cookie;
		$id_item = ((int)(Tools::getValue('item')));
		$id_ct = ((int)(Tools::getValue('ct')));
		if (!$id_item) $id_item = 1;
		if (!$id_ct) $id_ct = 0;
		$albums = Zalbum::getAlbumsItem ($id_item,$id_ct,$cookie->id_lang,1,20);
		$nbAlbum = Zalbum::getNumberAlbums($id_item,$id_ct);
		$nbAlbumPRP = Zalbum::getAlbumPV($id_item,$cookie->id_lang);
		self::$smarty->assign(array (
			'id_item' => $id_item,
			'id_ct' =>  $id_ct,
			'albums' => $albums,
			'albumsPrp' => $nbAlbumPRP,
			'nb' => $nbAlbum,
			'path' => __PS_BASE_URI__.'modules/zgallery/img/',
		));
	}
	
	public function displayContent() 
	{
		
		self::$smarty->display(_PS_MODULE_DIR_.'zgallery/views/zgalleryItem.tpl');
	}
}